Description of programs/code

INSTRUCTIONS: All analyses for replication are contained in a single R file entitled "Replication.R",  which is divided into sections that correspond with the paper's sections. The functions that are used in the statistical analyses are also contained in the "Replication.R" file and are defined at the beginning of each section in which they are used.

Each section's code should be run in the order in which it appears in that section. To run the code of only one section, make sure that the relevant dataset has been loaded. In the "Replication.R" file, each dataset is loaded at the beginning of the first section in which that dataset is used and is not loaded again thereafter. E.g., "puertorico.RData" is loaded at the beginning of "Section: Survey Experimental Design," and is not reloaded thereafter when it is used in "Section: Marginal Effects of Skin Color and Language," among others.

The working directory of the "Replication.R" file is set via "setwd(dirname(rstudioapi::getActiveDocumentContext()$path))" to the directory in which the "Replication.R" is saved locally on the replicator's computer. To properly load the data, make sure that the datasets are saved in the same directory. The R packages used in the analyses are all loaded at the beginning of the script right after setting the working directory. The versions of each package are commented in the script right after they are loaded.

Below I describe each section of the "Replication.R" file:

"Section: The Case of Puerto Rico and Hurricane Maria" reproduces Figure 1 of the article using the "salience.RData" dataset.

"Section: Survey Experimental Design" reproduces Tables 1, 2 and 5 in the article. Table 1 uses the "puertorico.RData" dataset, which contains the survey experiment embedded in the 2018 CCES. Table 2 uses the "CCES_Pre_Test.RData" dataset, which contains data from a pre-test conducted on Mechanical Turk. Table 5 uses the "ANES_2018.RData" dataset and the broader "CCES_2018.RData" dataset within which the survey experiment was embedded.

"Section: Marginal Effects of Skin Color and Language" first defines a general function to estimate the marginal effects and then uses this function to produce Tables 6 and 7 with the "puertorico.RData" dataset.

"Section: Heterogeneous Effects of Skin Color and Language" also defines a general function for the estimation of heterogeneous effects and then uses that function to produce Tables 8 and 9 with the "puertorico.RData" dataset.

"Appendix A: Descriptive Statistics" reproduces Tables 1 - 3 in the appendix using the "puertorico.RData" dataset.

"Appendix B: Full Interaction Model for Heterogeneous Effects" runs the full interaction models contained in Table 4 of Appendix B using the "puertorico.RData" dataset.

